package com.tfswue.jqr.controller;

import com.tfswue.jqr.entity.Order;
import com.tfswue.jqr.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/orders")
//@RefreshScope
public class OrderController {
    @Autowired
    private OrderService orderService;

//    // nacos 读取配置
//    @Value("${server.port}")
//    private String port;
//    @GetMapping("/port")
//    public String getPort() {
//        return "端口:" + port;
//    }
//    @Value("${config.info}")
//    private String configInfo;
//    @GetMapping("/config/info")
//    public String getConfigInfo() {
//        return "configInfo:" + configInfo;
//    }

    @RequestMapping("/{id}")
    public Order getOrderById(@PathVariable("id") Long id) {
        return orderService.getOrderById(id);
    }
}
